<?php
/**
 * Created by PhpStorm.
 * User: hebidu
 * Date: 15/12/3
 * Time: 11:14
 */

namespace Test\Controller;

use Common\Api\BoyeServiceApi;

class TestJsqDbController extends TestController{


    public function index(){

        $this->display();
    }

    public function historyQuery(){

        if(IS_POST){

            $data = array(
                'ddid'=> I('post.ddid',''),
                'api_ver'=>$this->api_ver,
                'notify_id'=>$this->notify_id,
                'type'=>'BY_JsqDb_historyQuery',
                'alg'=>'md5',
            );

            $service = new BoyeServiceApi();

            $result = $service->callRemote("",$data,true);

            $this->parseResult($result);

        }

        $this->display();
    }

    public function historyDaysQuery(){

        if(IS_POST){

            $data = array(
                'ddid'=> I('post.ddid',''),
                'api_ver'=>$this->api_ver,
                'notify_id'=>$this->notify_id,
                'type'=>'BY_JsqDb_historyDaysQuery',
                'alg'=>'md5',
            );

            $service = new BoyeServiceApi();

            $result = $service->callRemote("",$data,true);

            $this->parseResult($result);

        }

        $this->display();
    }

    public function historyMonthsQuery(){

        if(IS_POST){

            $data = array(
                'ddid'=> I('post.ddid',''),
                'api_ver'=>$this->api_ver,
                'notify_id'=>$this->notify_id,
                'type'=>'BY_JsqDb_historyMonthsQuery',
                'alg'=>'md5',
            );

            $service = new BoyeServiceApi();

            $result = $service->callRemote("",$data,true);

            $this->parseResult($result);

        }

        $this->display();
    }

    private function parseResult($result){
        echo "解密后数据：";
        dump($result);
    }


}